<template>
  <div>
    <el-button v-on:click="login()">登录</el-button>
  </div>
</template>
<script type="text/ecmascript-6">
  import {mapState,mapGetters} from 'vuex'
  import {setCookie} from '../common/common'
/*
  var mqtt = require('mqtt')
    var client  = mqtt.connect('ws://192.168.1.2:1884',{
      username:'58aab94b0cf2c9985fbeab0b',
      password:'533b7d3953ef8ed16fabd1f6aee7148f199511c5',
      clientId:'app_13800000000_'
    });

    client.on('connect', function () {
      console.log('connected.....');
      client.subscribe('#');
      client.publish('app2dev/', 'Hello mqtt');
    });

    client.on('message', function (topic, message) {
      // message is Buffer
      console.log(message.toString());
      //client.end();
    });
*/


  export default {
    name: 'login',
    data () {
      return {
        msg: 'Welbcome to Your Vue.js App'
      }
    },
    methods: {
      login: function () {
        setCookie('token','fff',30)
      }
    },
    computed: {
      /*...mapState({
        ddd: 'ddd',
      }),
      ...mapGetters([
        'doneTodosCount',
        'anotherGetter',
        // ...
      ])*/
    }
  }
</script>
